﻿@model Forest.Cat.Web.Models.Catalog.AdvSearchViewModel
@{
    ViewBag.Title = "高级搜索";
    Layout = "~/Views/Shared/_NormalRoot.cshtml";
    Html.EnableClientValidation(false);
}
<script type="text/javascript">
    $(document).ready(function () {
        $('#btnAdvSearch').bind('click', function () {
            var educationLevelList = $('#AdvSearchConditionModel_EducationLevelList');
            var jobTypeList = $('#AdvSearchConditionModel_JobTypeList');
            $('.Education').find('input:checked').each(function () {
                educationLevelList.val(educationLevelList.val() + $(this).val() + ',');
            });
            $('.JobType').find('input:checked').each(function () {
                jobTypeList.val(jobTypeList.val() + $(this).val() + ',');
            });

            $('#AdvSearchConditionModel_JobCategory1').val($('#jobCategoryList1').val());
            $('#AdvSearchConditionModel_JobCategory2').val($('#jobCategoryList2').val());
        });

        $('.clearAll').bind('click', function () {
            $('#AdvSearchForm')[0].reset();
        });
    });
</script>
<style type="text/css">
    select{ width:300px}
    .text{ width:300px}
</style>
<div class="main_result">
    找工作 &gt; <b>高级搜索</b></div>
<div class="browse_content">
    <div class="adversearch_content_left">
        <h3>
            <a href="#">高级搜索</a><a href="#" class="clearAll">全部清除</a></h3>
        <div class="adversearch_content_left_box">
            @using (Html.BeginForm("AdvSearch", "CataLog", FormMethod.Post, new { @id = "AdvSearchForm" }))
            { 
                @Html.HiddenFor(x => x.AdvSearchConditionModel.JobCategory1)
                @Html.HiddenFor(x => x.AdvSearchConditionModel.JobCategory2)
                <table cellpadding="10" cellspacing="10">
                    <tr>
                        <td colspan="2">
                            <p>
                                关键字</p>
                            @Html.TextBoxFor(x => x.AdvSearchConditionModel.KeyWord, new { @class = "text" })<p />
                        </td>
                    </tr>
                    <tr>
                        <td width="320px">
                            <p>
                                行业</p>
                            <p>@Html.DropDownListFor(x => x.AdvSearchConditionModel.Industry1, Model.IndustryList) </p>
                            <p>@Html.DropDownListFor(x => x.AdvSearchConditionModel.Industry2, Model.IndustryList) </p>
                        </td>
                        <td width="320px">
                            <p>
                                职位类别</p>
                            <p>
                                @{var index = 0;}
                                <select id="jobCategoryList1">
                                    @foreach (var item in Model.JobCategoryList)
                                    {
                                        if (index == 0) 
                                        {
                                            <option value=""></option>    
                                        }
                                        index++;
                                        <optgroup label="@item.Name">
                                            <!--循环显示子类-->
                                            @foreach (var subItem in Model.SubJobCategoryList.Where(x => x.ParentId.Value.Equals(item.Id)))
                                            {
                                                <option value="@subItem.Value">@subItem.Name</option>
                                            }
                                        </optgroup>
                                    }
                                </select>
                            </p>
                            <p>
                                @{index = 0;}
                                <select id="jobCategoryList2">
                                    @foreach (var item in Model.JobCategoryList)
                                    {
                                        if (index == 0) 
                                        {
                                            <option value=""></option>    
                                        }
                                        index++;
                                        <optgroup label="@item.Name">
                                            <!--循环显示子类-->
                                            @foreach (var subItem in Model.SubJobCategoryList.Where(x => x.ParentId.Value.Equals(item.Id)))
                                            {
                                                <option value="@subItem.Value">@subItem.Name</option>
                                            }
                                        </optgroup>
                                    }
                                </select>
                            </p>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            @Html.HiddenFor(x => x.AdvSearchConditionModel.EducationLevelList)
                            <p>
                                教育程度</p>
                        </td>
                        <td>
                            @Html.HiddenFor(x => x.AdvSearchConditionModel.JobTypeList)
                            <p>
                                职位类型</p>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top" align="left">
                            <table class="Education">
                                @{index = 0;}
                                @foreach (var item in Model.EducationLevelList)
                                {
                                    index++;
                                    if (index % 2 == 1)
                                    {
                                        @:<tr> 
                                    }
                                    <td style="padding:5px 50px 10px 0px"><input type="checkbox" value="@item.Value"/> @item.Text</td>
                                    if (index % 2 == 0)
                                    {
                                        @:</tr>
                                    }
                                }
                            </table>
                        </td>
                        <td  valign="top" align="left">
                            <table class="JobType">
                                @{index = 0;}
                                @foreach (var item in Model.JobTypeList)
                                {
                                    index++;
                                    if (index % 2 == 1)
                                    {
                                        @:<tr> 
                                    }
                                    <td style="padding:5px 50px 10px 0px"><input type="checkbox" value="@item.Value"/> @item.Text</td>
                                    if (index % 2 == 0)
                                    {
                                        @:</tr>
                                    }
                                }
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <p>公司性质</p>
                            <p>@Html.DropDownListFor(x => x.AdvSearchConditionModel.CompanyType, Model.CompanyTypeList) </p>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <p>发布日期</p>
                            <p>@Html.DropDownListFor(x => x.AdvSearchConditionModel.PostedDate, Model.PostedDateList) </p>
                        </td>
                    </tr>
                </table>
                <div class="adversearch_line">
                </div>
                <div class="adversearch_btns">
                    <input type="image" id="btnAdvSearch" src="/Themes/DarkOrange/Content/images/img-adversearcbtn-86-20.jpg" /></div>
            }
        </div>
    </div>
    <div class="browse_content_right">
        <div class="browse_content_title">
            热门搜索</div>
        <div class="browse_content_box">
            <ul>
                @foreach (var hotword in Model.HotWordList) 
                { 
                    <li>@Html.ActionLink(hotword.WordText, "SearchJobList", "Catalog", new { jobTitle = hotword.WordText }) 
                    </li>
                }
            </ul>
        </div>
    </div>
    <div class="cr">
    </div>
</div>
